//
//  PersonAbstractModelPost.m
//  __PRODUCTNAME__
//
//  Created by Hanlingyu on 16/09/16
//  Copyright (c) ltq. All rights reserved.
//

#import "PersonAbstractModelPost.h"
#import "PersonAbstractModelImg.h"
#import "PersonAbstractModelTag.h"
#import "PersonAbstractModelChannel.h"

@implementation PersonAbstractModelPost

- (void)setValue:(id)value forKey:(NSString *)key {
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"img"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            PersonAbstractModelImg *img = [PersonAbstractModelImg modelWithDic:dic];
            [array addObject:img];
        }
        _img = array;
    } else if ([key isEqualToString:@"channel"]) {
        _channel = [PersonAbstractModelChannel modelWithDic:value];
    } else if ([key isEqualToString:@"tag"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            PersonAbstractModelTag *tag = [PersonAbstractModelTag modelWithDic:dic];
            [array addObject:tag];
        }
        _tag = array;
    }
}

+ (NSDictionary *)objectClassInArray{
    return @{@"img" : [PersonAbstractModelImg class], @"tag" : [PersonAbstractModelTag class]};
}

@end
